/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#ifndef BURNDLGJLINK_H
#define BURNDLGJLINK_H
#include "BurnDlg.h"
#include "ui_BurnDlgJLink.h"
#include "DiaglogJLinkSetting.h"

namespace BurnDlg {

class BurnDlgJLink : public BurnDlg {
    Q_OBJECT
public:
    explicit BurnDlgJLink(ChipType chipType, QWidget *pParent = nullptr);
    ~BurnDlgJLink() override;
    void AnalyseBinFile(QString filePath);
    void InitBurnCtrl() override;
private:
    void InitConnect();
    void UpdateVersion(const QString &version) const;
    void InitTableView() const;
    void UpdateList() override;
    void UpdateList(BIN_INFO_ARRAY &info) const;
    void RemoveTempDir() const;
    void InitMenus();
    void contextMenuEvent(QContextMenuEvent *event) override;

protected slots:
    void SlotShowMenuSettings() override;
    void SlotBnClickedButtonSelectfile() override;
    void SlotBnClickedButtonStartburn() override;
    void SlotBurnFileFinish();
    void SlotSetProgress(double pos) const;
    void SlotInsertPlainText(const QString &editStr) override;
    void SlotBurnFileFailed();
    void SlotCreateNewFwpkgFile();
    void SlotSaveSpiltFwpkgFile();
private:
    Ui::BurnDlgJLink *ui;
    QAction *actSettings;
    QAction *actImportConfig;
    QAction *actSaveConfig;
    QMap<int, BIN_INFO> burnInfo;
    QTimer *configTimer;
    QAction *actChangeChip;
    QAction *actAbout;
    DiaglogJLinkSetting *jLinksetting;
    QMenu *tableViewMenu;
};

}
#endif // BURNDLGJLINK_H
